<template>
  <div>
    <van-nav-bar title="新增订阅" @click-right="$emit('close')">
      <template #right>
        <van-icon name="close" size="18"/>
      </template>
    </van-nav-bar>
    <van-cell v-for="(subject, index) in subjects" clickable is-link :key="index" :title="subject"
              @click="$emit('confirm', subject)"/>
  </div>
</template>

<script>

export default {
  data() {
    return {
      subjects: []
    }
  },
  methods: {
    load() {
      this.$requests.post('/msg/notice/subject').then(resp => {
        this.subjects = resp
      })
    }
  },
  mounted() {
    this.load()
  }
}
</script>
